<script type="text/javascript">
function save(){
	var options = {
		beforeSubmit:  showRequest,  // pre-submit callback 
		success:       showResponse  // post-submit callback 
    };
	$('#frmManagement').ajaxSubmit(options);
}

function showRequest(formData, jqForm, options) {
	var form = jqForm[0];
}

function showResponse(responseText, statusText, xhr, $form) {
	if(responseText=='success'){
		location.href=root+"admincp/"+module+"/#/save";
	}
}
</script>

<div class="table">
	<div class="head_table"><div class="head_title_edit"><?=$module?></div></div>
	<div class="clearAll"></div>

	<form id="frmManagement" action="<?=PATH_URL.'admincp/'.$module.'/save/'?>" method="post" enctype="multipart/form-data">
	<input type="hidden" value="<?=$id?>" name="hiddenIdAdmincp" />
    <div class="row_text_field_first">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Status:</td>
				<td class="right_text_field"><input <?php if(isset($result->status)){ if($result->status==1){ ?>checked="checked"<?php }}else{ ?>checked="checked"<?php } ?> type="checkbox" class="custom_chk" name="statusAdmincp" /></td>
			</tr>
		</table>
	</div>
	<div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">UserName:</td>
				<td class="right_text_field">
					<select name="usernameAdmincp" id="username" style="padding:5px;">
						<option value="0"> -- Select Username --</option>
						<?php if(isset($users))
						{
							foreach($users AS $s)
							{
						?>
							<option value="<?=$s->id?>" <?php if(isset($result->user_id)){ if($result->user_id == $s->id){ echo "selected='selected'";}}?>><?=$s->username?></option>
						<?php 
							}
						}
						?>
					</select>
				</td>
			</tr>
		</table>
	</div>
     <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Facebook ID:</td>
				<td class="right_text_field"><input value="<?php if(isset($result->fb_id)) { print $result->fb_id; }else{ print '';} ?>" type="text" name="fb_idAdmincp"/></td>
			</tr>
		</table>
	</div>
	<div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Content:</td>
				<td class="right_text_field"><input value="<?php if(isset($result->content)) { print $result->content; }else{ print '';} ?>" type="text" name="contentAdmincp"/></td>
			</tr>
		</table>
	</div>
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Like:</td>
				<td class="right_text_field"><input value="<?php if(isset($result->like)) { print $result->like; }else{ print '';} ?>" type="text" name="likeAdmincp"/></td>
			</tr>
		</table>
	</div>
	<div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Image Thumb:</td>
				<td class="right_text_field"><input type="file" name="fileAdmincp[image]" /><?php if(isset($result->thumb)){ if($result->thumb!=''){ ?> - <a class="fancyboxClick" href="<?=PATH_URL.'static/uploads/contest/'.$result->thumb?>">Review</a><?php }} ?></td>
			</tr>
		</table>
	</div>
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Receive Name</td>
				<td class="right_text_field"><input value="<?php if(isset($result->send_name)) { print $result->send_name; }else{ print '';} ?>" type="text" name="send_nameAdmincp"/></td>
			</tr>
		</table>
	</div>
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Receive Address</td>
				<td class="right_text_field"><input value="<?php if(isset($result->receive_address)) { print $result->receive_address; }else{ print '';} ?>" type="text" name="send_addessAdmincp"/></td>
			</tr>
		</table>
	</div>
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Weeks:</td>
				<td class="right_text_field">
					<select name="weeksAdmincp" id="weeks" style="padding:5px;">
						<option value="0"> -- Select Province --</option>
						<?php if(isset($province))
						{
							foreach($province AS $s)
							{
						?>
							<option value="<?=$s->id?>" <?php if(isset($result->province_id)){ if($result->province_id == $s->id){ echo "selected='selected'";}}?>><?=$s->name?></option>
						<?php 
							}
						}
						?>
					</select>
				</td>
			</tr>
		</table>
	</div>
	</form>
</div>